/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/6/13
 * Time: 03:28
 */

public class Solution {
    public static int firstUniqChar(String s){
        int[] array = new int[26];
        for(int i = 0;i < s.length();i++){
            char cur = s.charAt(i);
            array[cur-'a']++;
        }
        for(int i = 0;i < s.length();i++){
            if(array[s.charAt(i)-'a'] == 1){
                return i;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        System.out.println(firstUniqChar("leetcode"));
    }
}